///@file Tensor3.h
///@brief Declaration of the class representing a third order tensor
///@author Arnaud Duval
///@version 0.0
///@date 2009/10/19


#ifndef TENSOR3_H
#define TENSOR3_H

#include <assert.h>
#include <iostream>
#include "Tensor2.h"

///@class Tensor3
///@brief Class defining a third order tensor
///A third order tensor is an array of second order tensors
class Tensor3
{
	private:
		///@brief Array of second order tensors
		Tensor2 *t;
		///@brief Dimension of the tensor
		unsigned int size;
	public:
		///@brief Default constructor
		Tensor3();
		///@brief Constructor giving the dimension
		Tensor3(int);
		///@brief Copy constructor
		Tensor3(const Tensor3 &);
		///@brief Copy constructor with temporary object
		Tensor3(Tensor3*);
		///@brief Destructor
		~Tensor3();
		///@brief Overload of () operator
		double& operator()(unsigned int, unsigned int, unsigned int);
		///@brief Overload of = operator
		Tensor3& operator = (const Tensor3);
		///@brief Overload of = operator for temporary objects
		Tensor3& operator = (Tensor3*);
		///@brief Overload of += operator
		void operator += (const Tensor3&);
		///@brief Overload of -= operator
		void operator -= (const Tensor3&);

		///@brief Overload of + operator : addition of 2 Tensor3
		friend Tensor3 operator + (const Tensor3&, const Tensor3&);
		///@brief Overload of - operator : substraction of 2 Tensor3
		friend Tensor3 operator - (const Tensor3&, const Tensor3&);
		///@brief Overload of * operator : product Tensor3 - scalar
		friend Tensor3 operator * (const Tensor3&, const double&);
		///@brief Overload of * operator : product scalar - tensor3
		friend Tensor3 operator * (const double&, const Tensor3&);
		///@brief Overload of / operator : division by a scalar
		friend Tensor3 operator / (const Tensor3&, const double&);

		///@brief Overload of << operator
		friend std::ostream& operator<<(std::ostream &, const Tensor3&);

};



#endif